import {
	createApp
} from 'vue';
import './style.css';
import App from './App.vue';
import router from './router';
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css';
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import 'element-plus/theme-chalk/dark/css-vars.css';
import store from './store';

import Login from '../src/components/Login.vue'

const app = createApp(App);

// 注册 Element Plus 图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	app.component(key, component);
}

// 设置路由导航守卫
router.beforeEach((to, from, next) => {
	// 动态设置页面标题
	if (to.meta.title) {
		document.title = to.meta.title;
	}
	next();
});

// 使用插件
app.use(router);
app.use(store);
app.use(ElementPlus, {
	locale: zhCn
});
app.component('Login',Login)
app.mount('#app');